﻿@model MobileSales.Model.Tasks.Task


@{
    View.Title = Strings.Tasks + " - " + Strings.Edit;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="@Url.Content("~/Scripts/Tasks.js")" type="text/javascript"></script>
<h2>@Strings.Tasks &nbsp;&raquo;&nbsp; @Strings.Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Fields</legend>
        
        @Html.Hidden("employeeId", ViewData["employeeId"])
        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.ClientId)
        </div>
        <div class="editor-field">
            @Html.ClientSelect("ClientId",
                               false, 
                               (Model.ClientId.HasValue) ? new int[] { Model.ClientId.Value } : null,
                               true)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Info)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Info)
            @Html.ValidationMessageFor(model => model.Info)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Priority)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Priority)
            @Html.ValidationMessageFor(model => model.Priority)
        </div>

        <div class="editor-label">
            @ModelStrings.Date
        </div>
        <div class="editor-field">
            <input type="text" class="datepicker" id="datePickerDay" value="@Model.StartTime.ToShortDateString()" />
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StartTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartTime)
            <input type="text" class="timepicker" id="timePickerStart" value="@Model.StartTime.ToShortTimeString()" />
            @Html.ValidationMessageFor(model => model.StartTime)

        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EndTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndTime)
            <input type="text" class="timepicker" id="timePickerEnd" value="@Model.EndTime.ToShortTimeString()" />
            @Html.ValidationMessageFor(model => model.EndTime)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.RealStartTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RealStartTime)
            @Html.ValidationMessageFor(model => model.RealStartTime)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.RealEndTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RealEndTime)
            @Html.ValidationMessageFor(model => model.RealEndTime)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StartPositionLatitude)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartPositionLatitude)
            @Html.ValidationMessageFor(model => model.StartPositionLatitude)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StartPositionLongitude)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.StartPositionLongitude)
            @Html.ValidationMessageFor(model => model.StartPositionLongitude)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EndPositionLatitude)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndPositionLatitude)
            @Html.ValidationMessageFor(model => model.EndPositionLatitude)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.EndPositionLongitude)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndPositionLongitude)
            @Html.ValidationMessageFor(model => model.EndPositionLongitude)
        </div>

         <div class="editor-label">
            @Html.LabelFor(model => model.TaskStatus)
        </div>
        <div class="editor-field">
            @Html.TaskStatusSelect("taskStatusId", Model.TaskStatus.Id)
        </div>   
        
         <div class="editor-label">
            @Html.LabelFor(model => model.TaskType)
        </div>
        <div class="editor-field">
            @Html.TaskTypeSelect("taskTypeId", Model.TaskType.Id)
        </div>       

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>    
    @Html.ActionLink(Strings.BackToList, "Details", "Schedules", new { employeeId = ViewData["employeeId"], date = Model.StartTime.ToShortDateString() }, new { @class = "icon-button prev-icon" })
    
</div>

